import {computed, ref} from 'vue';
import {defineStore} from 'pinia';

// 创建全局Store实例并传递全局状态（此处为组合式API）
export const useCounterStore = defineStore('counter', () => {
  const count = ref(0);
  const doubleCount = computed(() => count.value * 2);
  function increment() {
    count.value++;
  }
  
  // 暴露全局属性与方法
  return {count, doubleCount, increment};
});
